// OUTDOOR SECTION SCRIPT
//    Section: X = 0, Y = 0: Spiderweb Valley

//FLAGS
//(2,0) = state 12: pretty trees

beginoutdoorscript;

variables;
int i,j,k,lvl,choice;

body;

beginstate INIT_STATE;
// This state called whenever this section is loaded into memory.
break;

beginstate START_STATE;
// Starting state of the section, called every turn the party 
// stands inside this section until you change the state.
break;

beginstate 10; //leave?
	if (get_flag(1,5) == 0){
		reset_dialog();
		add_dialog_str(0,"You have not yet completed the ritual. If you leave now, your progress will always be stopped by the Shareware Demon. Is that really what you want?",0);
		add_dialog_str(1,"Are you still just gonna leave?",0);
	}
	else{
		reset_dialog();
		add_dialog_str(0,"Are you ready to leave the scenario?",0);
	}
	add_dialog_choice(0,"Not yet.");
	add_dialog_choice(1,"Yes, I'm done here.");
	choice = run_dialog(1);
	if (choice == 1)
		block_entry(1);
	if (choice == 2)
		set_state_continue(11);
break;

beginstate 11; //exit scen
	if (get_flag(1,5) == 0){
		message_dialog("The adventuring life isn't for everyone. You decide you would be much happier attempting to farm in the wastelands of Skylark Vale, the only place the Shareware Demon lets you go.","You worthless coward.");
		end_scenario(0);
	}
	else {
		reset_dialog_preset_options(0);
		add_dialog_str(0,"Now defeated with your completion of the Ritual of Registration, the Shareware Demon will never bother you again. It sees that you are worthy to be an adventurer, and it only harasses those who have not proven themselves.",0);
		add_dialog_str(1,"As horrifying as the Shareware Demon looked, it wasn't much of a threat, just an annoyance. Now that it's out of your way for good, you are free to seek your fortune on many more epic journeys.",0);
		add_dialog_str(2,"THE END",0);
		add_dialog_str(3,"...but it is really only the beginning...",10);
		choice = run_dialog(0);
		end_scenario(1);
	}
break;

beginstate 12;
	if (get_flag(2,0) == 0){
		reset_dialog_preset_options(0);
		add_dialog_str(0,"As you step outside of the Registration Temple grounds, you notice what you couldn't in the dark. The flora around here is quite lovely, particularly the tree clusters.",0);
		if (get_flag(3,1) == 0)
			add_dialog_str(1,"Whoever planted these must have really known what they were doing.",0);
		else add_dialog_str(1,"Ephesos apparently really knows how to take care of his trees.",0);
		choice = run_dialog(0);
		if (choice == 1)
			set_flag(2,0,1);
		message_dialog("Now you turn your gaze back to the temple. It, too, is much prettier from out here.","");
	}
break;